


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Visual Studio 2010 Notes &mdash; Leptonica &amp; Visual Studio 2008</title>
    <link rel="stylesheet" href="_static/leptonica.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '1.68',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/sidebar.js"></script>
    <link rel="top" title="Leptonica &amp; Visual Studio 2008" href="index.html" />
    <link rel="next" title="Package Contents" href="package-contents.html" />
    <link rel="prev" title="(Optional) Building the liblept library" href="building-liblept.html" />
 
    <link href='http://fonts.googleapis.com/css?family=Droid+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Droid+Sans:regular,bold' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
    <script type="text/javascript" src="http://www.google-analytics.com/urchin.js"></script>
    <script type="text/javascript" src="_static/sort-filter-table-compact.js"></script>
   


  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="package-contents.html" title="Package Contents"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="building-liblept.html" title="(Optional) Building the liblept library"
             accesskey="P">previous</a> |</li>
  <li><a href="http://www.leptonica.com">Leptonica Home</a> &raquo;</li>
  
        <li><a href="index.html">VS2008 Notes (for v1.68)</a> &raquo;</li>
 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="visual-studio-2010-notes">
<span id="vs2010-notes"></span><h1>Visual Studio 2010 Notes<a class="headerlink" href="#visual-studio-2010-notes" title="Permalink to this headline">¶</a></h1>
<ul>
<li><p class="first">Programs built with Visual Studio 2010 can link with the <strong>static</strong>
binary libraries supplied in the <span class="filesystem">liblept</span> <a class="reference internal" href="downloading-binaries.html"><em>Visual Studio 2008
pre-built binaries for Windows archive</em></a>.</p>
<p>You can also link with the <strong>dynamic</strong> binary libraries as long as you
follow these rules:</p>
<ul>
<li><p class="first">Any memory allocated by <span class="filesystem">liblept</span> has be be freed with the new
<tt class="docutils literal"><span class="pre">lept_free()</span></tt> function. For example, this includes the strings
returned by <tt class="docutils literal"><span class="pre">getLeptonicaVersion()</span></tt>, <tt class="docutils literal"><span class="pre">getImagelibVersions()</span></tt>,
and <tt class="docutils literal"><span class="pre">genTempFilename()</span></tt>, and the data created by
<tt class="docutils literal"><span class="pre">pixWriteMemTiff()</span></tt>.</p>
</li>
<li><p class="first">Any file handles required by <span class="filesystem">liblept</span> have to be created by the
new <tt class="docutils literal"><span class="pre">lept_fopen()</span></tt> function and closed with the new
<tt class="docutils literal"><span class="pre">lept_fclose()</span></tt> function.</p>
</li>
</ul>
<p>Failure to follow these rules will result in a crash due to the
simultaneous use of two incompatible C Runtime DLLs (<span class="filesystem">msvcr90.dll</span> and
<span class="filesystem">msvcr100.dll</span>). See <a class="reference external" href="http://stackoverflow.com/q/4171403">Using Visual Studio 2010, how can one link to a
DLL generated by Visual Studio 2008</a> for the gory details.</p>
</li>
<li><p class="first">When converting the VS2008 Solution, you&#8217;ll get a number of warnings
like the following in the Conversion Report:</p>
<div class="highlight-none"><div class="highlight"><pre>MSB8012: $(TargetName) (&#39;liblept168&#39;) does not match the Librarian&#39;s OutputFile property value &#39;LIB Debug\liblept168-static-mtdll-debug.lib&#39; (&#39;liblept168-static-mtdll-debug&#39;) in project configuration &#39;LIB Debug|Win32&#39;. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetName) property value matches the value specified in %(Lib.OutputFile).
</pre></div>
</div>
<p>Fix the <em class="guilabel">liblept</em><em class="guilabel">168</em> project by doing the following:</p>
<ol class="arabic">
<li><p class="first">Right-click on <em class="guilabel">liblept</em><em class="guilabel">168</em> and choose
<em class="menuselection">P<span class="accelerator">r</span>operties</em>.</p>
</li>
<li><p class="first">Then change <em class="guilabel">liblept</em><em class="guilabel">168</em> <em class="guilabel">Property Pages
| General | Target Name</em> to one of the following values:</p>
<p>For the <em class="guilabel">LIB Debug</em> Configuration:</p>
<div class="highlight-none"><div class="highlight"><pre>$(ProjectName)-static-mtdll-debug
</pre></div>
</div>
<p>For the <em class="guilabel">LIB Release</em> Configuration:</p>
<div class="highlight-none"><div class="highlight"><pre>$(ProjectName)-static-mtdll
</pre></div>
</div>
<p>For the <em class="guilabel">DLL Debug</em> Configuration:</p>
<div class="highlight-none"><div class="highlight"><pre>$(ProjectName)d
</pre></div>
</div>
</li>
</ol>
<p>The <em class="guilabel">ioformats_reg</em> project also needs to be fixed:</p>
<ol class="arabic">
<li><p class="first">Right-click on <em class="guilabel">ioformats_reg</em> and choose
<em class="menuselection">P<span class="accelerator">r</span>operties</em>.</p>
</li>
<li><p class="first">From the <em class="guilabel"><span class="accelerator">C</span>onfiguration</em> dropdown menu choose
<em class="guilabel">All Configurations</em>.</p>
</li>
<li><p class="first">Change <em class="guilabel">ioformats_reg Property Pages | Linker | General |
Output File</em> to:</p>
<div class="highlight-none"><div class="highlight"><pre>$(OutDir)$(TargetName)$(TargetExt)
</pre></div>
</div>
</li>
<li><p class="first">You still need to follow the instructions at <a class="reference internal" href="building-prog-dir.html#building-prog-programs-vs2008"><em>create a new
Visual Studio Project</em></a>.</p>
</li>
</ol>
<p>Exit and restart Visual Studio (or close and reopen the <span class="filesystem">liblept</span>
solution).</p>
</li>
<li><p class="first">To use the &#8220;Create Leptonica prog Project AddIn&#8221; follow the
<a class="reference internal" href="building-prog-dir.html#building-prog-programs-vs2008"><em>instructions</em></a> for Visual Studio
2008 but copy <span class="filesystem">vs2008\CreateLeptonicaProgProjects.AddIn</span> and
<span class="filesystem">vs2008\CreateLPP.dll</span> to your Visual Studio 2010 Addins folder
(normally <span class="filesystem">C:\My Documents\Visual Studio 2010\Addins</span>).</p>
<p>Edit <span class="filesystem">CreateLeptonicaProgProjects.AddIn</span> and change:</p>
<div class="highlight-none"><div class="highlight"><pre>&lt;Version&gt;9.0&lt;/Version&gt;
</pre></div>
</div>
<p>to:</p>
<div class="highlight-none"><div class="highlight"><pre>&lt;Version&gt;10.0&lt;/Version&gt;
</pre></div>
</div>
</li>
<li><p class="first">The <a class="reference internal" href="building-image-libraries.html"><em>building</em></a> of the image libraries
has not been tested using Visual Studio 2010. Given the problems
encountered while building <span class="filesystem">liblept</span> you can probably expect to have
some issues.</p>
</li>
</ul>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<div style="text-align: center; padding-right: 5px;">
 <a href="http://www.leptonica.com" >
  <img src="_static/moller52-smaller.jpg" border="0" alt="Leptonica Home"/>
 </a>
</div>



<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="downloading-binaries.html">Downloading <span class="filesystem">liblept</span> pre-built binaries and header files for Windows</a></li>
<li class="toctree-l1"><a class="reference internal" href="building-other-programs.html">Building programs that link with <span class="filesystem">liblept</span></a></li>
<li class="toctree-l1"><a class="reference internal" href="directory-organization.html">Directory organization</a></li>
<li class="toctree-l1"><a class="reference internal" href="vs2008-solution.html">The <span class="filesystem">liblept</span> Visual Studio 2008 Solution</a></li>
<li class="toctree-l1"><a class="reference internal" href="building-prog-dir.html">Building the <span class="filesystem">prog</span> directory programs</a></li>
<li class="toctree-l1"><a class="reference internal" href="installing-cygwin.html">Installing Cygwin coreutils</a></li>
<li class="toctree-l1"><a class="reference internal" href="installing-irfanview.html">Installing IrfanView to view images</a></li>
<li class="toctree-l1"><a class="reference internal" href="installing-gnuplot.html">Installing gnuplot to view plots</a></li>
<li class="toctree-l1"><a class="reference internal" href="csharp-and-liblept.html">c# and <span class="filesystem">liblept</span></a></li>
<li class="toctree-l1"><a class="reference internal" href="building-image-libraries.html">(Optional) Building <span class="filesystem">zlib</span>, <span class="filesystem">libjpeg</span>, <span class="filesystem">libpng</span>, <span class="filesystem">libtiff</span> and <span class="filesystem">giflib</span></a></li>
<li class="toctree-l1"><a class="reference internal" href="building-liblept.html">(Optional) Building the <span class="filesystem">liblept</span> library</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Visual Studio 2010 Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="package-contents.html">Package Contents</a></li>
<li class="toctree-l1"><a class="reference internal" href="versions.html">Version Notes</a></li>
</ul>


<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="package-contents.html" title="Package Contents"
             >next</a></li>
        <li class="right" >
          <a href="building-liblept.html" title="(Optional) Building the liblept library"
             >previous</a> |</li>
  <li><a href="http://www.leptonica.com">Leptonica Home</a> &raquo;</li>
  
        <li><a href="index.html">VS2008 Notes (for v1.68)</a> &raquo;</li>
 
      </ul>
    </div>
  <div class="footer">

   <span class="creativecommons">
    <a href="http://creativecommons.org/licenses/by/3.0/us/" >
      <img src="_static/creativecommons-88x31.png"
	   border="0" alt="Creative Commons License"/>
     </a>
    Leptonica by 
    <a href="http://leptonica.com/www.leptonica.org">
    Dan Bloomberg
    </a>
    is licensed under a
    <a href="http://creativecommons.org/licenses/by/3.0/us/">
     Creative Commons Attribution 3.0 United States License.
    </a>
   </span>

   
   <span class="sphinxcreditr">
   Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
   </span>
   

    <script type="text/javascript">
      _uacct = "UA-144810-1";
      urchinTracker();
    </script>
  </div>
  </body>
</html>